<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Log file removal</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="up" href="transapp.html" title="Chapter 12.  Berkeley DB Transactional Data Store Applications" />
    <link rel="prev" href="transapp_archival.html" title="Database and log file archival" />
    <link rel="next" href="transapp_recovery.html" title="Recovery procedures" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.2</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Log file removal</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="transapp_archival.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 12.  Berkeley DB Transactional Data Store Applications </th>
          <td width="20%" align="right"> <a accesskey="n" href="transapp_recovery.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="transapp_logfile"></a>Log file removal</h2>
          </div>
        </div>
      </div>
      <p>
        The fourth component of the infrastructure, log file
        removal, concerns the ongoing disk consumption of the database
        log files. Depending on the rate at which the application
        writes to the databases and the available disk space, the
        number of log files may increase quickly enough so that disk
        space will be a resource problem. For this reason, you will
        periodically want to remove log files in order to conserve
        disk space. This procedure is distinct from database and log
        file archival for catastrophic recovery, and you cannot remove
        the current log files simply because you have created a
        database snapshot or copied log files to archival
        media.
    </p>
      <p>
        Log files may be removed at any time, as long as:
    </p>
      <div class="itemizedlist">
        <ul type="disc">
          <li>
            the log file is not involved in an active
            transaction.
        </li>
          <li>
            a checkpoint has been written subsequent to the log
            file's creation.
        </li>
          <li>
            the log file is not the only log file in the
            environment.
        </li>
        </ul>
      </div>
      <p>
        Additionally, when Replication Manager is running the log
        file is older than the most out of date active site in the
        replication group.
    </p>
      <p>
        If you are preparing for catastrophic failure, you will want
        to copy the log files to archival media before you remove them
        as described in <a class="xref" href="transapp_archival.html" title="Database and log file archival">Database and log file
        archival</a>.
    </p>
      <p>
        If you are not preparing for catastrophic failure, any one
        of the following methods can be used to remove log
        files:
    </p>
      <div class="orderedlist">
        <ol type="1">
          <li>
            Run the standalone <a href="../api_reference/C/db_archive.html" class="olink">db_archive</a> utility with the <span class="bold"><strong>-d</strong></span> option, to remove any log
            files that are no longer needed at the time the command is
            executed.
        </li>
          <li>
            Call the <a href="../api_reference/C/logarchive.html" class="olink">DB_ENV-&gt;log_archive()</a> method from the application,
            with the <a href="../api_reference/C/logarchive.html#archive_DB_ARCH_REMOVE" class="olink">DB_ARCH_REMOVE</a> flag, to remove any log files
            that are no longer needed at the time the call is
            made.
        </li>
          <li>
            Call the <a href="../api_reference/C/envlog_set_config.html" class="olink">DB_ENV-&gt;log_set_config()</a> method from the
            application, with the <a href="../api_reference/C/envlog_set_config.html#log_set_config_DB_LOG_AUTO_REMOVE" class="olink">DB_LOG_AUTO_REMOVE</a> flag, to remove
            any log files that are no longer needed on an ongoing
            basis. With this configuration, Berkeley DB will
            automatically remove log files, and the application will
            not have an opportunity to copy the log files to backup
            media.
        </li>
        </ol>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="transapp_archival.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="transapp.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="transapp_recovery.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Database and log file
        archival </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Recovery procedures</td>
        </tr>
      </table>
    </div>
  </body>
</html>
